<!DOCTYPE html>
<html>
<head>
	<title>图片上传</title>
	<meta charset="UTF-8">
	<link href="http://www.cnblogs.com/favicon.ico" rel="shortcut icon">
</head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
    
</style>
<body style="padding: 200px">


<form id= "uploadForm">  
      <input name="avatar" id='upfile' type='file' value='选择文件' multiple/>
</form>

<div id="images"></div>



</body>
</html>

<script type="text/javascript">


  upfile.onchange=()=>{
     var formData=new FormData($("#uploadForm")[0])
     $.ajax({  
	      url: '/upload',  
	      type: 'POST',  
	      data: formData,  
	      contentType: false,  
	      processData: false,
	      success:(result)=>{
	          result.map(r=>$('#images').append('<img style="width:300px;padding:5px;" src="http://localhost:8000/images/'+r+'">'))
	      },  
	      error:(err)=>console.log(err) 
      })
   }



</script>






